package it.tukano.fun;

/**
 * A function1 that returns void
 * @author pgi
 * @param <PARAM>
 */
public abstract class VFunction1<PARAM> implements Function1<PARAM, Void> {

    /**
     * Instance initializer
     */
    public VFunction1() {
    }

    /**
     * Calls doApply and returns null
     * @param p the parameter passed to doApply
     * @return null
     */
    public Void apply(PARAM p) {
        doApply(p);
        return null;
    }

    /**
     * Subtypes should implement this do execute the function body
     * @param p the parameter of the function
     */
    protected abstract void doApply(PARAM p);
}
